//============Confirm section ===================================================================

function confirm() {
$('#Iphone_rich_notification_content').val(tinyMCE.get('Iphone_rich_notification_content').getContent());
	serialize = $("#mainPushForm").serialize();
	//console.log(serialize);
	console.log(serialize);
	
	$.post('appcamel/index.php?r=ajax/confirm',serialize,function(result){
    //$('#login_alert').html(result);});
	//if(result.match("SUCCESS")) alert ("All ok.");
	//else alert ("Something wrong!");
	//console.log(result);
	console.log(result);
	push_sended_ok=result;
	switch (result)
	{
	case '1':
	$('#login_alert').text("All ok.");
	break;
	case '0':
	$('#login_alert').text("Please login.");
	break;
	default:
	$('#login_alert').text(result);
	}
	
	});
	
	
}
//============END Confirm section ===================================================================

function setMessageType(messageType){
	$('#iph_msg_type').val(messageType);
}

$(document).ready(function(){
	
  //placeholder for subjects
  $('.subject').each(function() {
  	 $(this).attr("placeholder", "Subject");
 	 $(this).focus(function(event){
       this.placeholder = '';
    	});
      $(this).blur(function(event){
       this.placeholder = 'Subject';
    	});
	});
	
	$('.subjdeluxe').each(function() {
  	 $(this).attr("placeholder", "Subject");
 	 $(this).focus(function(event){
       this.placeholder = '';
    	});
      $(this).blur(function(event){
       this.placeholder = 'Subject';
    	});
	});
   
   //placeholder for push messages
    $('.message').each(function() {
     $(this).attr("placeholder", "Your message");
 	 $(this).focus(function(event){
       this.placeholder = '';
    	});
      $(this).blur(function(event){
       this.placeholder = 'Your message';
    	});
	});
});
 
 
function update_pre (os) {
if (os=='iphone') 

if ($('#iph_msg_type').val()=='base') $('#iphone_text_pre').html($('#Iphone_notification_content').val()); 
else 
{
	$('#iphone_text_pre').html($('#Iphone_rich_notification_subject').val()+tinyMCE.get('Iphone_rich_notification_content').getContent());
}
if (os=='android') $('#android_text_pre').html($('#Android_notification_subject').val()+'</BR>'+$('#Android_notification_content').val());
if (os=='blackberry') $('#blackberry_text_pre').html($('#Blackberry_notification_content').val());
} 

